package com.hzncc.flowable_diboot.project_contracts.vo;

import com.diboot.core.binding.annotation.BindDict;
import com.diboot.core.binding.annotation.BindEntityList;
import com.diboot.core.binding.annotation.BindField;
import com.diboot.core.binding.annotation.BindFieldList;
import com.diboot.core.vo.FileVO;
import com.diboot.core.vo.LabelValue;
import com.diboot.file.entity.FileRecord;
import com.diboot.iam.entity.IamUser;
import com.hzncc.flowable_diboot.entity.SapCustomer;
import com.hzncc.flowable_diboot.project_contracts.entity.ProjectContractAudit;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * 项目类合同评审 VO定义
 *
 * @author MyName
 * @version 1.0
 * @date 2024-09-24
 * Copyright © MyCorp
 */
@Getter
@Setter
@Accessors(chain = true)
public class ProjectContractAuditListVO extends ProjectContractAudit {
    private static final long serialVersionUID = 1205205695894200120L;

    /**
     * 合同类型 关联字典选项
     */
    @BindDict(
            type = "contractType",
            field = "contractType"
    )
    private LabelValue contractTypeLabel;

    /**
     * OA状态 关联字典选项
     */
    @BindDict(
            type = "OaStatus",
            field = "oaStatus"
    )
    private LabelValue oaStatusLabel;

    /**
     * SAP状态 关联字典选项
     */
    @BindDict(
            type = "SapStatus",
            field = "sapStatus"
    )
    private LabelValue sapStatusLabel;

    /**
     * 业务板块 关联字典选项
     */
    @BindDict(
            type = "contractBusinessModel",
            field = "businessModel"
    )
    private LabelValue businessModelLabel;

    @BindFieldList(
            entity = IamUser.class,
            field = "id",
            condition = "this.id = mdl_project_contract_audit_iam_user.project_contract_audit and mdl_project_contract_audit_iam_user.`user` = id"
    )
    private List<String> starUids;

    /**
     * 关注人 关联信息
     */
    @BindFieldList(
            entity = IamUser.class,
            field = "userNum",
            condition = "this.id = mdl_project_contract_audit_iam_user.project_contract_audit and mdl_project_contract_audit_iam_user.`user` = id"
    )
    private List<String> starUidsLabel;

    /**
     * 项目类型 关联字典选项
     */
    @BindDict(
            type = "projectType",
            field = "projectType"
    )
    private LabelValue projectTypeLabel;

    /**
     * 片区 关联字典选项
     */
    @BindDict(
            type = "salesArea",
            field = "salesTerritory"
    )
    private LabelValue areaLabel;

    /**
     * 客户类型 关联字典选项
     */
    @BindDict(
            type = "projectContractCustomerCate",
            field = "cutomerCate"
    )
    private LabelValue cutomerCateLabel;

    /**
     * 录入人 关联信息
     */

    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.entry_person = id"
    )
    private String entryPersonLabel;

    /**
     * 创建人 关联信息
     */

    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.create_by = id"
    )
    private String createByLabel;

    /**
     * 更新人 关联信息
     */

    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.update_by = id"
    )
    private String updateByLabel;

    /**
     * 销售员员工编号 关联信息
     */
    @BindField(
            entity = IamUser.class,
            field = "userNum",
            condition = "this.saler = id"
    )
    private String salerNum;

    /**
     * 负责人
     */
    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.header = id"
    )
    private String headerName;

    /**
     * 销售员
     */
    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.saler = id"
    )
    private String salerName;

    /**
     * 签订人
     */
    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.signer = id"
    )
    private String signerName;

    @BindDict(
            type = "contractStatus",
            field = "contractStatus"
    )
    private String contractStatusLabel;

    private Boolean isStar;

    @BindDict(
            type = "auditType",
            field = "auditType"
    )
    private LabelValue auditTypeLabel;

    @BindDict(
            type = "projectContractStatus",
            field = "status"
    )
    private LabelValue statusLabel;

    @BindEntityList(
            entity = FileRecord.class,
            condition = "this.auditAttachment = id",
            splitBy = ","
    )
    private List<FileVO> auditAttachmentFiles;

    @BindDict(
            type = "businessUnit",
            field = "businessDept"
    )
    private LabelValue businessDeptLabel;


    @BindDict(
            type = "SAPCustomrBusiness",
            field = "customerNature"
    )
    private LabelValue customerNatureLabel;
}